﻿@inherits BButtonBase
@{
    var isPlain = string.Empty;
    if (IsPlain)
    {
        isPlain = "is-plain";
    }
    var isRound = string.Empty;
    if (IsRound)
    {
        isRound = "is-round";
    }
    var isDisabled = string.Empty;
    if (IsDisabled)
    {
        isDisabled = "is-disabled";
    }

    var icon = Icon;
    var isLoading = string.Empty;
    if (IsLoading)
    {
        isLoading = "is-loading";
        isDisabled = "is-disabled";
        icon = "el-icon-loading";
    }

    var buttonSize = string.Empty;
    switch (Size)
    {
        case ButtonSize.Default:

            break;
        default:
            buttonSize = Size.ToString().ToLower();
            break;
    }
    var cls = $"el-button el-button--{Type.ToString().ToLower()} {isPlain} {isRound} {isDisabled} {isLoading} el-button--{buttonSize}";
    if (!string.IsNullOrWhiteSpace(Cls))
    {
        cls = Cls;
    }
}
<button type="button" @onclick="OnButtonClickedAsync" style="@Style" class="@cls">
    @if (string.IsNullOrWhiteSpace(icon))
    {
        <span>@ChildContent</span>
    }
    else
    {
        <i class="@icon"></i>
        if (IsLoading)
        {
            <span>@ChildContent</span>
        }
    }
</button>